<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			* {
				margin: 0;
				padding: 0;
			}

			body {
				background-color: #F5F5F5;
				text-align: center;
			}

			a {
				text-decoration: none;
			}

			p {
				font-size: 14px;
			}

			:focus {
				outline: none;
			}

			#bigbox {
				width: 850px;
				height: 480px;
				background-color: white;
				margin: auto auto;
				position: relative;
				top: 150px;
			}

			.p1 {
				font-size: 30px;
				position: relative;
				top: 40px;
			}

			.logo {
				width: 50px;
				height: 50px;
				background-color: #FF6700;
				/* border-radius: 5%; */
				margin: auto auto;
				position: relative;
				top: 0px;
			}

			#phonenumber {
				margin: 0 0 0 0px;
				color: #FF6700;
				position: relative;
				top: 67px;
				left: -10px;
				font-size: 13px;
			}

			.p2 {
				position: relative;
				top: 88px;
				color: #666666;
				left: -110px;
			}

			.p3 {
				position: relative;
				top: 68px;
				color: #666666;
				left: -110px;
			}

			.password1 {
				width: 330px;
				height: 40px;
				border: 1px solid #E0E0E0;
				margin: auto auto;
				position: relative;
				top: 80px;
			}

			#password1 {
				border: transparent;
				width: 320px;
				height: 30px;
				font-size: 14px;
				/* border: 1px solid #000; */
				margin: 6px 5px;
			}

			.password2 {
				width: 330px;
				height: 40px;
				border: 1px solid #E0E0E0;
				margin: auto auto;
				position: relative;
				top: 90px;
			}

			#password2 {
				border: transparent;
				width: 320px;
				height: 30px;
				font-size: 14px;
				/* border: 1px solid #000; */
				margin: 6px 5px;
			}

			#submit {
				width: 332px;
				height: 40px;
				position: relative;
				top: 110px;
				background-color: #FF6700;
				color: white;
				line-height: 40px;
				font-size: 14px;
				margin: auto auto;
			}

			.dibu {
				width: 600px;
				height: 60px;
				/* border: 1px solid #000; */
				color: #757575;
				font-size: 14px;
			}

			.dibu_nav li {
				list-style: none;
				display: inline-block;
				margin: 5px 10px;
				/* color: #C2B0B7; */
			}

			.dibu {
				margin: auto auto;
				position: relative;
				top: 380px;
				line-height: 20px;
			}

			.dibu_nav_dwon li {
				list-style: none;
				display: inline-block;
				margin: 5px 10px;
				/* color: #C2B0B7; */
			}
		</style>
	</head>
	<body>
		<div id="bigbox">
			<div id="erweima"></div>
			<div class="logo">
				<img src="http://s02.mifile.cn/assets/static/image/mi-logo.png">
			</div>
			<p class="p1">注册小米账号</p>
			<b>
				<p class="p2">您注册的手机号为</p><span id="phonenumber"></span>
				<p class="p3">请设置您的密码：</p>
			</b>
			<div class="password1">
				<input type="password" id="password1" placeholder="请输入密码" />
			</div>
			<div class="password2">
				<input type="password" id="password2" placeholder="请输入确认密码" />
			</div>
			<div id="submit">
				提交
			</div>
			<div class="dibu">
				<nav class="dibu_nav">
					<li style="color: #333333;font-size: 14px;">简体</li><span>|</span>
					<li>繁体</li><span>|</span>
					<li>English</li><span>|</span>
					<li>常见问题</li>
				</nav>
				<nav class="dibu_nav_dwon">
					<li>小米公司版权所有-京ICP备10046444-<img src="https://account.xiaomi.com/static/res/9204d06/account-static/respassport/acc-2014/img/ghs.png">京公网安备11010802020134号-京ICP证110507号</li>
				</nav>
			</div>

			<script src="js/jquery-3.4.1.js" type="text/javascript" charset="utf-8"></script>
			<script type="text/javascript">
				$(function() {
					var obj = JSON.parse(localStorage.getItem('obj'));
					console.log(obj);
					var number = obj.number;
					var code = obj.code;
					$("#phonenumber").text(number);
					var password1 = "";
					var password2 = "";
					$("#password1").on("input",function(){
						password1 = $("#password1").val();
					});
					$("#password2").on("input",function(){
						password2 = $("#password2").val();
					});
					$("#submit").on("click", function() {
						if (password1==""&&password2 =="") {
							alert("请输入密码");
						}else{
							if (password1 != password2) {
								alert("两次密码输入不一致！请重新输入密码~");
								// $("#password1").text("");
								// $("#password2").text("");
							} else {
								$.ajax({
									url: "https://test.shop.deepe.ren/api/register",
									data: {
										"account": number,
										"password": password2,
										"captcha": code
									},
									method: "post",
									success: function(data) {
										console.log(data);
										alert(data.msg);
										$(location).attr("href", "登录界面.html");
									},
									error: function() {
										alert("请求失败");
									}
								});
							};
						};
					});
				});
			</script>
	</body>
</html>
